﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ImageDemo1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();


        }

        private void button2_Click(object sender, EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();
            dialog.ShowDialog();
            if (dialog.FileName == "")
                return;
            using (FileStream stream = File.Open(dialog.FileName,FileMode.Open))
            {
                using (StreamReader reader = new StreamReader(stream))
                {
                    String rtf=reader.ReadToEnd();
                    RTF2Image.Rtf2ImageConverter converter = new RTF2Image.Rtf2ImageConverter();
                    ImageContainer.Image = converter.CreateImage(rtf);
                    ImageContainer.Image.Save(@"E:\3.png");
                }
            }
        }
    }
}
